#include <random>
#include <chrono>
#include <typeinfo>

#define OUT cout
#define asc 0
#define dsc 1
#define rnd 2

template<class T,class Integer>
        class MyRandom {
            private:
            T from;
            T to;
            Integer cnt;
            unsigned seed;
            public:
            MyRandom () {
                this->from= ( T ) 0;
                this->to = ( T ) 0;
                this->cnt = ( Integer ) 0;
                seed = chrono::system_clock::now().time_since_epoch().count();
            }
            inline void bringChange ( T from_, T to_, Integer cnt_ ) {
                this->from=T ( from_ );
                this->to = T ( to_ );
                this->cnt = Integer ( cnt_ );
            }
            inline void generateSingleRandom ( bool );
            inline void generatePairRandom ( bool, int type );
            inline void generateStringRandom ( bool );
        };
template<class T, class Integer>
        inline void MyRandom<T,Integer>::generateSingleRandom ( bool printCaseCount ) {
        default_random_engine generator ( seed );

        //print number of cases
        if ( printCaseCount ) OUT<<cnt<<"\n";

        if ( typeid ( T ).name() ==typeid ( float ).name() ||typeid ( T ).name() ==typeid ( double ).name() ) {
            uniform_real_distribution<double> distribution ( from,to );
            while ( ( cnt-- ) >0 ) {
                T number = distribution ( generator );
                OUT<<number<<" ";
            }
        } else {
            uniform_int_distribution<T> distribution ( from,to );
            while ( ( cnt-- ) >0 ) {
                T number = distribution ( generator );
                OUT<<number<<" ";
            }
        }
        OUT<<"\n";
    }

template<class T, class Integer>
        inline void MyRandom<T,Integer>::generatePairRandom ( bool printCaseCount, int type ) {
        default_random_engine generator ( seed );

        //print number of cases
        if ( printCaseCount ) OUT<<cnt<<"\n";

        if ( typeid ( T ).name() ==typeid ( float ).name() ||typeid ( T ).name() ==typeid ( double ).name() ) {
            uniform_real_distribution<double> distribution ( from,to );
            while ( ( cnt-- ) >0 ) {
                T number1 = distribution ( generator );
                T number2 = distribution ( generator );
                if ( type==asc && number1>number2 ) swap ( number1,number2 );
                else if ( type==dsc && number1<number2 ) swap ( number1,number2 );
                else if ( type==rnd ) {
                    ;
                }
                OUT<< number1<<" "<<number2<<'\n';
            }
        } else {
            uniform_int_distribution<T> distribution ( from,to );
            while ( ( cnt-- ) >0 ) {
                T number1 = distribution ( generator );
                T number2 = distribution ( generator );
                if ( type==asc && number1>number2 ) swap ( number1,number2 );
                else if ( type==dsc && number1<number2 ) swap ( number1,number2 );
                else if ( type==rnd ) {
                    ;
                }
                OUT<< number1<<" "<<number2<<'\n';
            }
        }


    }
template<class T, class Integer>
        inline void MyRandom<T,Integer>::generateStringRandom ( bool printCaseCount ) {
        default_random_engine generator ( seed );

        string const str="GB";
        int len=LN ( str );

        //print number of cases
        if ( printCaseCount ) OUT<<len<<"\n";

        uniform_int_distribution<int> distribution ( from,to );
        while ( ( cnt-- ) >0 ) {
            T number = distribution ( generator );
            OUT<< ( str[number%3] );
        }
        OUT<<"\n";

    }

// kate: indent-mode cstyle; indent-width 4; replace-tabs on; 
